package com.motong.gongdan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.motong.gongdan.entity.Product;
import com.motong.gongdan.vo.H5Resp.H5InventoryResp;
import com.motong.gongdan.vo.H5Resp.H5ProductFinishNumResp;
import com.motong.gongdan.vo.H5Vo.H5CodeVo;
import com.motong.gongdan.vo.H5Vo.common.GroupCountVo;
import com.motong.gongdan.vo.H5Vo.stock.query.StockBalanceQuery;
import com.motong.gongdan.vo.system.stock.vo.StockBalanceVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface ProductMapper extends BaseMapper<Product> {


    List<H5InventoryResp> getStockBalance(@Param("seek") String seek, @Param("sortOrd") String sortOrd, @Param("sortProp") String sortProp
            , @Param("screen") String screen);


    /**
     * 根据查询条件获取产品信息(h5 库存余额)
     *
     * @param query 查询条件
     */
    IPage<H5InventoryResp> getStockBalanceByQuery(@Param("query") StockBalanceQuery query, Page<Product> page);


    IPage<Product> getProductList(Page<Product> page, @Param("h5CodeVo") H5CodeVo screen);

    Page<H5ProductFinishNumResp> getProductFinishNum(Page<H5ProductFinishNumResp> page, @Param("screen") String screen, @Param("productIds") List<Integer> productIds);


    /**
     * 获取工艺路线
     *
     * @param productIds 产品ids
     */
    List<Map<String, Object>> getProcessByProductId(@Param("productIds") Set<Integer> productIds);

    /**
     * 根据查询条件归类产品属性获取产品信息(h5 库存余额)
     *
     * @param query 查询条件
     */
    List<Map<String, Object>> getCountGroupByAttribute(@Param("query") StockBalanceQuery query);

    /**
     * 获取产品库存数量
     * */
    List<Product> getProductStock();

    /**
     * 获取报工的库存数量
     * */
    List<Product> getWorkReportStock();

    Page<Product> getStockBalancePC(Page<Product> page, @Param("query") StockBalanceVo query);

    List<GroupCountVo> getTypeCountMap(@Param("query") StockBalanceVo searchCondition, @Param("groupColumn") String groupColumn);

    long getGroupCountVo(@Param("query") StockBalanceVo mergeSearchResult);


}
